<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title><?=getValInArr(getSess(SESS_DIC),array('webInfo','webtitle'))?></title>
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport"/>
    <meta content="yes" name="apple-mobile-web-app-capable"/>
    <meta content="black" name="apple-mobile-web-app-status-bar-style"/>
    <meta content="telephone=no" name="format-detection"/>
    <script src="<?php echo base_url().'public/home/js/' ?>jquery.js"></script>
    <?php include_once "public/home/html/bootstrap.php"  ?>
    <?php include_once "public/home/html/imgupload.php"  ?>
    <?php include_once "public/home/html/alert.php"  ?>   
    <script type="text/javascript" src="<?php echo base_url().'public/home/js/' ?>function.js"></script>
    <link rel="stylesheet" href="<?php echo base_url().'public/h_ui/lib/Hui-iconfont/1.0.8/' ?>iconfont.css">
    <link rel="stylesheet" href="<?php echo base_url().'public/home/css/' ?>mui.min.css">
    <?php include_once "public/home/html/alert.php"  ?>   
    <script type="text/javascript" src="<?php echo base_url().'public/home/js/' ?>function.js"></script>
    <link rel="stylesheet" href="<?php echo base_url().'public/assets/css/' ?>font-awesome.min.css">
</head>
<body>
    <style>
        html{
          overflow:scroll!important;
        }
        body{
            padding: 3%;
            text-align: center;
            background-color: #ffffff;
        }
        textarea{
            margin-top: 5%;
            margin-bottom: 5%;
        }
        #submit{
            margin-top: 15%;
            width:30%;
        }
        .float_left{
            float: left;
        }
        .clear{
            clear: both;
        }
    </style>
    <input type="hidden" name='url' value="<?php echo base_url()?>">
    <input type="hidden" name='sub_role' value="">
    <div class="search-head header mui-bar mui-bar-nav row" style="background-color: #f7f9fa; border:none;">
        <div class="col-xs-1" style="margin-top: 3%">
            <a class=" Hui-iconfont Hui-iconfont-slider-left" href="javascript:void(0)" id="last_submit" style="color: #C9C9C9"></a>
        </div>
        <div class="col-xs-11">
            <h1 class="mui-title" style="color:#333;margin-left: -5%">已提交的听课表</h1>
        </div>
    </div>

    <div style="margin-top: 15%;text-align: left;">
        <ul class="list-group">
            <?php 
            if($detail==''||$detail==null){echo "还未提交过听课评价表！";exit;}
            foreach ($detail as $k => $v) {
                echo "<li class='list-group-item' attend_id='".$v['id']."'  class_type='".$v['class_type']."' created='".$v['created']."'><div><div class='col-xs-10'  onclick='editAssess(this)' attend_id='".$v['id']."' class_type='".$v['class_type']."' created='".$v['created']."'>".$v['listen_class']."</div><div class='col-xs-2' style='text-align:right'><i class='icon-remove' onclick='del(this)' attend_id='".$v['id']."'></i></div><div class='clear'></div><div  onclick='editAssess(this)' attend_id='".$v['id']."' class_type='".$v['class_type']."' created='".$v['created']."'>".$v['class_name']."-".$v['teacher_name']."-".$v['type_char']."<div></div></li>";
            }
        ?>
        </ul>
    </div>

    <script>

$(function(){
            refresh();
            $("#last_submit").click(function(event) {
                window.location.href =$('input[name="url"]').val()+ 'Home/Index/evaluation';
                // window.Location.href= $('input[name="url"]').val()+ 'Home/Class_Assess/Index/'+category+'/0';
            });
        })

        function editAssess(t){
            var attend_id=$(t).attr('attend_id');
            var class_type=$(t).attr('class_type');
            var created=$(t).attr('created');
            var class_id=$(t).find('.class_id').val();
            // console.log(class_type.indexOf("实训"));
            //  2022-08-15 15:28:04之前的沿用旧的课程类型，2022-08-15 15:28:04之后的沿用新的课程类型 
            if( class_type.indexOf("实训")!=-1  && created>1660548484){
                // window.location.href=$("input[name='url']").val()+'Home/Index/choiceClassType/'+attend_id+'/3';
                window.location.href=$("input[name='url']").val()+'Home/Class_Assess/Index/3/2/'+attend_id;
            }else if( class_type.indexOf("思政")!=-1){
                // window.location.href=$("input[name='url']").val()+'Home/Index/choiceClassType/'+attend_id+'/3';
                window.location.href=$("input[name='url']").val()+'Home/Class_Assess/Index/3/3/'+attend_id;
            }else{
                if(created<1660548484){
                    window.location.href=$("input[name='url']").val()+'Home/Class_Assess/Index/7/1/'+attend_id;
                }else{
                    window.location.href=$("input[name='url']").val()+'Home/Class_Assess/Index/3/1/'+attend_id;
                }
               
            }
           
        }
        function del(t){
            var attend_id=$(t).attr('attend_id');
               dialog1 = jqueryAlert({
                   'style': 'wap',
                   'title': '删除',
                   'content': '请确认是否删除!',
                   'modal': true,
                   'contentTextAlign': 'left',
                   'width': '300',
                   'height': '150',
                   'animateType': 'linear',
                   'buttons': {
                    '否':function(){
                        dialog1.close();
                    },
                       '是': function() {
                           dialog1.close();
                           $.ajax({
                               url: $("input[name='url']").val()+'Home/Class_Assess/delAssess',
                               type: 'POST',
                               dataType: 'json',
                               data: {attend_id: attend_id},
                               success:function(data){
                                   if(data.status){
                                       var dialog1 = jqueryAlert({
                                           'icon': $('input[name="url"]').val() + 'public/home/alert/img/right.png',
                                           'content': data.msg,
                                           'closeTime': 3000,
                                       })
                                       setTimeout("location.reload()",2000);
                                   }else{
                                        var dialog1 = jqueryAlert({
                                           'icon': $('input[name="url"]').val() + 'public/home/alert/img/error.png',
                                           'content': data.msg,
                                           'closeTime': 3000,
                                       })
                                   }
                               }
                           })
                       }
                       

                }
            })
           
            
        }

        function refresh(){
            //ios...
            window.onpageshow = function(e){
                if(e.persisted){
                    window.location.reload();
                }
            }
            //android;
            var flag = window.sessionStorage.getItem('shouldRefresh');
            if(flag){
                window.sessionStorage.removeItem('shouldRefresh');
                window.location.reload();
            }
        }
    </script>
</body>
</html>
